package com.fullertontech.framework.job;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.xxl.job.core.executor.XxlJobExecutor;

@Configuration
public class JobConfig {
	@Value("${xxl.job.executor.appname}")
	private String appName;
	@Value("${xxl.job.admin.addresses}")
	private String adminAddresses;
	@Value("${xxl.job.executor.port}")
	private Integer port;
	
	
	@Bean(initMethod="start",destroyMethod="destroy")
	public XxlJobExecutor productXxlJobExecutor() {
		XxlJobExecutor xxlJobExecutor=new XxlJobExecutor();
		xxlJobExecutor.setAccessToken("");
		xxlJobExecutor.setAppName(appName);
		xxlJobExecutor.setAdminAddresses(adminAddresses);
		xxlJobExecutor.setPort(port);
		xxlJobExecutor.setLogPath("/var/logs/jobExecutor");
		xxlJobExecutor.setLogRetentionDays(30);
		return xxlJobExecutor;
	}
}
